<%--
  Created by IntelliJ IDEA.
  User: 86188
  Date: 2019/1/16
  Time: 15:30
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>添加机构信息</title>
    <link rel="stylesheet" href="/static/layuiadmin/layui/css/layui.css" media="all">
    <script type="text/javascript" src="/static/layuiadmin/layui/layui.js"></script>
    <script type="text/javascript" src="/static/js/jquery-3.1.1.min.js"></script>
    <script src="/static/layuiadmin/layui/layui.js" charset="UTF-8"></script>
    <style type="text/css">
        .layui-textarea {
            min-height: 40px;
            height: 40px;
            line-height: 17px;
            padding: 10px 9px;
            resize: vertical
        }

        body {
            padding: 10px;
        }

        .pick-area {
            display: inline-block;
        }

        .a {
            float: left;
            width: 100%;
            margin: 10px;
        }

        .a a {
            float: left;
            margin: 10px;
        }

        .a input {
            float: left;
            width: 400px;
            padding: 10px;
            margin: 10px;
            outline-color: gold;
        }
    </style>
</head>
<body>
<form class="layui-form layui-form-pane" id="myform">
    <table class="layui-table" style="text-align: center">
        <tr>
            <td>机构时间</td>
            <td>
                <textarea class="layui-textarea" name="mtime" id="test5" lay-verify="required" cols="20" placeholder="请选择机构时间"></textarea>
            </td>
        </tr>
        <tr>
            <td>机构类型</td>
            <td>
                <select name="mtype" id="mtype" lay-verify="required" lay-search="">
                    <option value="省级机构">省级机构</option>
                    <option value="市级机构">市级机构</option>
                    <option value="县级机构">县级机构</option>
                    <option value="镇级机构">镇级机构</option>
                </select>
            </td>
        </tr>
        <tr>
            <td>机构名称</td>
            <td>
                <input type="text" class="layui-input" name="mname" lay-verify="requireds" id="mname" placeholder="请输入机构名称">
            </td>
        </tr>
        <tr>
            <td>负责地区</td>
            <td>
                <textarea class="layui-textarea" name="mregion" id="mregion" lay-verify="required" cols="20" rows="1" placeholder="请输入负责地区"></textarea>
            </td>
        </tr>
        <tr>
            <td>添加人</td>
            <td>
                <textarea class="layui-textarea" name="madd" lay-verify="required" id="madd" cols="20" rows="1" readonly="readonly">${peopleinfo.pname}</textarea>
            </td>
        </tr>
        <tr>
            <td>操作</td>
            <td>
                <button class="layui-btn" lay-submit="" lay-filter="Refer">添加</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </td>
        </tr>
    </table>
</form>
</body>
<script>
    layui.use(['form', 'layedit', 'laydate'], function () {
        var form = layui.form
            , layer = layui.layer
            , layedit = layui.layedit
            , laydate = layui.laydate
        // form.render('select')
        form.on('submit(Refer)', function (data) {
            $.ajax({
                url: "addMechanism",
                type: "post",
                datatype: "json",
                data: {"mechanism": JSON.stringify(data.field)},
                success: function (data) {
                    console.log(data.filed)
                    //获取窗口索引
                    var index = parent.layer.getFrameIndex(window.name);
                    //关闭窗口
                    parent.layer.close(index);
                    parent.layer.msg(data.msg);
                }
            });
            return false;
        });
    });
</script>
<script>
    layui.use('laydate', function () {
        var laydate = layui.laydate;
        //日期时间选择器
        laydate.render({
            elem: '#test5'
            ,type: 'datetime'
        });
    })
</script>
</html>